package com.shine.cotrun.util;

import java.util.Properties;

import com.shine.cotrun.security.SymmetricAlgorithm;

/**
 * 此类来替换数据源密码
 * @author zsy
 *
 */
public class C3p0Properties extends Properties {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7948742761676310651L;

	public void setProperties(Properties properties) {
		String encrypt = properties.getProperty("encrypt");
		if ("true".equals(encrypt)) {
			String password = properties.getProperty("password");
			//解密
			password = new SymmetricAlgorithm(password).desDecrypt();

			properties.put("password", password);
		}
		this.putAll(properties);
	}
	
}
